
#ifndef PX_PARTICLE_INTEGRATOR_EULER_H
#define PX_PARTICLE_INTEGRATOR_EULER_H

#include <pxParticleIntegrator.h>

namespace Px {
namespace Physics {

template <typename Real>
class ParticleIntegrator_Euler : public ParticleIntegrator<Real> {
    using Vector3 = Math::Vector3<Real>;
    
public:
    void integrate(Real dt, Real mass, const Vector3& position, const Vector3& velocity, const Vector3& extForce, Vector3& newPosition, Vector3& newVelocity) const override;
};

template <typename Real>
void ParticleIntegrator_Euler<Real>::integrate(Real dt, Real mass, const Vector3& position, const Vector3& velocity, const Vector3& extForce, Vector3& newPosition, Vector3& newVelocity) const {
    newVelocity = velocity + (dt * extForce * (static_cast<Real>(1) / mass));
    newPosition = position + (dt * newVelocity);
}

typedef ParticleIntegrator_Euler<double> ParticleIntegrator_Eulerd;
typedef ParticleIntegrator_Euler<float> ParticleIntegrator_Eulerf;

}

}

#endif
